package com.bktech.stupidnews.controlpanel;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.bktech.stupidnews.R;

public class MyAddListAdapter extends BaseAdapter {

	ArrayList<Category> data;
	LayoutInflater inflate;

	public MyAddListAdapter(Context context, ArrayList<Category> data) {
		this.data = data;
		inflate = LayoutInflater.from(context);
		
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return data.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return data.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = inflate.inflate(R.layout.panel_setting_category_add,
					parent, false);
		}
		TextView tv = (TextView) convertView.findViewById(R.id.text_label);
		tv.setText(data.get(position).name);
		return convertView;
	}

}
